Developers of microcontroller systems often choose to store either executable instructions or data in nonvolatile memory devices that retain data even in the loss of power. Frequently, it is desirable that the memory space be writable as well as nonvolatile. One type of memory device, known as EEPROMs, is used in such application environments. This type of memory device typically stores data by charging or discharging voltages over a period of time and, consequently, introduce delay. Accordingly, an associated charge or discharge time limits the speed with which an EEPROM may be programmed. Reading data from such memory device types does not require such charging or discharging and therefore does not introduce significant delays, as with writing. This difference between read and write times imposes potentially significant design constraints.
Referring again to the specific example of an EEPROM device for illustration purposes, it is difficult for a single EEPROM device to store both executable instructions and data. This difficulty is a result of the prolonged write times. Because write times are longer than microcontroller instruction read (or fetch) times, a microcontroller arranged to use a single EEPROM to contain both executable instructions and data will attempt to fetch an instruction for execution prior to the expiration of a previous write cycle. With the previous write cycle still active, the microcontroller cannot fetch an instruction and is rendered inoperative.
In order to accommodate constraints of this type, many systems store executable instructions and data using separate memory devices. The use of separate memory devices, however, adds to the overall device size and cost of the system. Also, the use of an additional memory device introduces an additional component that can fail, reducing the overall reliability of the system. Furthermore, the additional power involved in operating extra memory devices presents a significant disadvantage in low-power applications, such as battery-powered systems, and generates additional heat and electrical noise. Moreover, solving the problem of prolonged write times by separately storing executable instructions and data fails to address the difficulties involved with writing the program memory. The program space remains inaccessible to the microcontroller, preventing the contents of the program memory from being altered dynamically. Hence, the execution of self-modifying programs is hindered.